using System.Threading.Tasks;
using Bingo.API.UI;
using CatLib;
using QFramework;

namespace Bingo.Facades
{
    /// <summary>
    /// UI门面类
    /// </summary>
    public class UI : Facade<IUI>
    {
        public static void Init()
        {
            Instance.Init();
        }

        public static void OpenUI<T>(string uiBehaviourName, IUIData uiData = null, string assetBundleName = null) where T : UIBasePanel
        {
            Instance.OpenUI<T>(uiBehaviourName, uiData, assetBundleName);
        }
        
        public static void CreateUI<T>(string uiBehaviourName, IUIData uiData = null, string assetBundleName = null) where T : UIBasePanel
        {
            Instance.CreateUI<T>(uiBehaviourName, uiData, assetBundleName);
        }

        public static void ShowUI<T>() where T : UIBasePanel
        {
            Instance.ShowUI<T>();
        }
        
        public static void HideUI<T>() where T : UIBasePanel
        {
            Instance.HideUI<T>();
        }

        public static void CloseUI<T>() where T : UIBasePanel
        {
            Instance.CloseUI<T>();
        }

        public static T GetUI<T>() where T : UIBasePanel
        {
            return Instance.GetUI<T>();
        }

        public static void CloseUI(string name)
        {
            Instance.CloseUI(name);
        }

        public static async Task ShowLoading()
        {
             await Instance.ShowLoading();
        }
        
        public static async Task HideLoading()
        {
            await Instance.HideLoading();
        }
    }
}